#ifndef CONFIG_H
#define CONFIG_H

#include <string>
#include "nlohmann/json.hpp"

using json = nlohmann::json;

struct ServerConfig {
    int udp_port = 10456;                // 默认UDP端口
    std::string log_path = "./logs/";  // 默认日志存储路径
    size_t flush_interval = 10 * 1000;           // 默认刷新间隔(毫秒)
    size_t max_file_size = 4 * 1024 * 1024; // 默认最大文件大小(4MB)
    std::string communication_mode = "broadcast"; // 通信模式："broadcast"或"unicast"
};

class ConfigManager {
public:
    static bool loadConfig(const std::string& filename, ServerConfig& config);
    static bool saveConfig(const std::string& filename, const ServerConfig& config);
};

#endif // CONFIG_H